|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
WARModule.java | 62.5% | 62.5% | 100% | 65.7% |
|
1 |
/*
|
|
2 |
* Copyright 2001-2004 The Apache Software Foundation.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
6 |
* You may obtain a copy of the License at
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*/
|
|
16 |
|
|
17 |
package org.apache.geronimo.ews.ws4j2ee.module;
|
|
18 |
|
|
19 |
import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
|
|
20 |
import org.apache.geronimo.ews.ws4j2ee.utils.FileUtils;
|
|
21 |
|
|
22 |
|
|
23 |
import java.io.File;
|
|
24 |
import java.io.IOException;
|
|
25 |
import java.net.MalformedURLException;
|
|
26 |
import java.net.URL;
|
|
27 |
import java.net.URLClassLoader;
|
|
28 |
import java.util.ArrayList;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* @author Srinath Perera(hemapani@opensource.lk)
|
|
32 |
*/
|
|
33 |
public class WARModule extends AbstractModule { |
|
34 |
private ArrayList urls;
|
|
35 |
private ClassLoader cl;
|
|
36 |
|
|
37 |
/**
|
|
38 |
* @param jarFile
|
|
39 |
* @throws GenerationFault
|
|
40 |
*/
|
|
41 | 3 |
public WARModule(String jarFile, ClassLoader parentCL,File outDir)
|
42 |
throws GenerationFault {
|
|
43 | 3 |
super(jarFile, parentCL);
|
44 | 3 |
try {
|
45 | 3 |
urls = FileUtils.uncompressWar(new File(outDir,"unpacked"), new File(zip.getName())); |
46 | 3 |
URL[] aurls = new URL[urls.size()];
|
47 | 3 |
for (int i = 0; i < aurls.length; i++) { |
48 | 3 |
aurls[i] = ((File) urls.get(i)).toURL(); |
49 | 3 |
System.out.println(aurls[i]); |
50 |
} |
|
51 | 3 |
cl = new URLClassLoader(aurls, Thread.currentThread().getContextClassLoader());
|
52 | 3 |
wscfFile = getInputStreamForJarEntry(jarFile, "WEB-INF/webservices.xml");
|
53 | 3 |
if (wscfFile == null) { |
54 | 0 |
wscfFile = getInputStreamForJarEntry(jarFile, "webservices.xml");
|
55 |
} |
|
56 | 3 |
webddfile = getInputStreamForJarEntry(jarFile, "WEB-INF/web.xml");
|
57 | 3 |
if (webddfile == null) |
58 | 0 |
webddfile = getInputStreamForJarEntry(jarFile, "web.xml");
|
59 | 3 |
if (wscfFile == null) |
60 | 0 |
throw new GenerationFault("wscf file must not be null"); |
61 |
} catch (MalformedURLException e) {
|
|
62 | 0 |
e.printStackTrace(); |
63 | 0 |
throw GenerationFault.createGenerationFault(e);
|
64 |
} catch (IOException e) {
|
|
65 | 0 |
e.printStackTrace(); |
66 | 0 |
throw GenerationFault.createGenerationFault(e);
|
67 |
} catch (GenerationFault e) {
|
|
68 | 0 |
e.printStackTrace(); |
69 | 0 |
throw GenerationFault.createGenerationFault(e);
|
70 |
} |
|
71 |
} |
|
72 |
|
|
73 |
/* (non-Javadoc)
|
|
74 |
* @see org.apache.geronimo.ews.ws4j2ee.utils.packager.load.PackageModule#getClassLoaderWithPackageLoaded()
|
|
75 |
*/
|
|
76 | 3 |
public ClassLoader getClassLoaderWithPackageLoaded() throws GenerationFault { |
77 | 3 |
return cl;
|
78 |
} |
|
79 |
|
|
80 | 2 |
public ArrayList getClassPathElements() {
|
81 | 2 |
return urls;
|
82 |
} |
|
83 |
|
|
84 |
} |
|
85 |
|
|